Skip to content

refactor: introduce helper for defining distribution filegroups - #4152

Merged
rickeylev merged 3 commits into
bazel-contrib:mainfrom
rickeylev:helper_dist_file_groups
Sep 7, 2026
Merged

refactor: introduce helper for defining distribution filegroups#4152
rickeylev merged 3 commits into
bazel-contrib:mainfrom
rickeylev:helper_dist_file_groups

Conversation

@rickeylev

Copy link
Copy Markdown
Collaborator

Previously, distribution filegroups required manually enumerating each
direct subpackage's distribution target in srcs. This created
repetitive boilerplate across BUILD files and risked omitting newly
added subpackages from release distributions.

Introduce the distribution_filegroup macro to automatically glob
package files and discover direct subpackages using
native.subpackages(), with support for an exclude list.

  • Also updates BUILD files across the repository to use the new macro

Previously, distribution filegroups required manually enumerating each
direct subpackage's distribution target in `srcs`. This created
repetitive boilerplate across BUILD files and risked omitting newly
added subpackages from release distributions.

Introduce the `distribution_filegroup` macro to automatically glob
package files and discover direct subpackages using `native.subpackages()`,
with support for an `exclude` list.

* Also updates BUILD files across the repository to use the new macro
@rickeylev
rickeylev requested a review from aignas as a code owner September 6, 2026 19:30
The root distribution archive omitted tools/build_defs/python/private
because native.subpackages(include = ["*"]) in tools/BUILD.bazel only
discovers direct subpackages. Without an intermediate package boundary,
the nested tools/build_defs/python package was skipped.

Add distribution_filegroup targets to tools/build_defs/BUILD.bazel and
tools/build_defs/python/BUILD.bazel so the distribution filegroup chain
recursively reaches tools/build_defs/python/private.
Downstream packaging fails because //tools/publish loads
//tools/private:publish_deps.bzl. Remove the exclude list so that
tools/private is included in distribution archives.

@aignas aignas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very elegant, thanks

@rickeylev
rickeylev added this pull request to the merge queue Sep 7, 2026
Merged via the queue into bazel-contrib:main with commit 14f436f Sep 7, 2026
5 checks passed
@rickeylev
rickeylev deleted the helper_dist_file_groups branch September 7, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants